<template>
	<view class="my-settle-container">
		<!-- 全选 -->
    <label class="radio" @click="changeAllState">
      <radio color="#f00000" :checked="isFullCheck"/><text>全选</text>
    </label>
    <!-- 总价格 -->
    <view class="amount-box">
      合计：<text>￥{{checkedGoodsAmount}}</text>
    </view>
    <!-- 结算按钮 -->
    <view class="btn-settle">
      结算({{checkedCount}})
    </view>
	</view>
</template>

<script>
  import {mapGetters,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
    methods:{
      ...mapMutations("m_cart",['updateAllGoodsState']),
      changeAllState(){
        this.updateAllGoodsState(!this.isFullCheck)
      }
    },
    computed:{
      ...mapGetters("m_cart",['checkedCount','total','checkedGoodsAmount']),
      isFullCheck(){
        // 如果总数量与选中商品数量相等,证明此时需要全选
        return this.checkedCount == this.total
      }
    }
	}
</script>

<style lang="scss">
.my-settle-container{
  position: fixed;
  width: 100%;
  left:0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  height: 50px;
  align-items: center;
  .radio{
    margin-left: 5px;
  }
  .amount-box{
    text{
       color: #f00000
    }
   
  }
  .btn-settle{
    background-color: #f00;
    color: white;
    font-size: 14px;
    text-align: center;
    height: 50px;
    line-height: 50px;
    min-width: 100px;
    padding:0 10px;
  }
}
</style>
